# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils

DESCRIPTION="Proxy cache for Gentoo packages"
HOMEPAGE="http://gertjan.freezope.org/"
SRC_URI="http://gertjan.freezope.org/replicator/${P}.tar.gz"

LICENSE="GPL-2.0"
SLOT="0"
KEYWORDS="x86 amd64 alpha"
IUSE=""

DEPEND=">=dev-lang/python-2.3
	<sys-apps/portage-2.0.51"

src_unpack() {
	unpack ${A}
	epatch ${FILESDIR}/${P}-conf-gentoo-patch
	epatch ${FILESDIR}/${P}-init-gentoo-patch
}

src_install(){
	# init script and main script into /usr/bin
	exeinto /usr/bin
	newexe debian/init http-replicator-init
	doexe ${FILESDIR}/repcacheman
	doexe HttpReplicator.py
	
	# Config file into /etc
	insinto /etc
	doins http-replicator.conf
	
	# Doc's
	newdoc debian/README.Debian README
	dodoc debian/changelog
	dodoc debian/copyright
	
	# init.d scripts
	exeinto /etc/init.d 
	newexe ${FILESDIR}/http-replicator-2.0-init  http-replicator
}


pkg_postinst() {
	einfo
	einfo "If you wish to change defaults"
	einfo "edit /etc/http-replicator.conf"
	einfo
	einfo "Execute /usr/bin/repcacheman "
	einfo "to auto create the cache directory"
	einfo "and prime the cache."
	einfo
}


